﻿namespace FMStudio.Documents
{
    /// <summary>
    /// The interface of document type with a specific type of the Document.
    /// </summary>
    /// <typeparam name="TDocument">The specific type of the document.</typeparam>
    public interface IDocumentType<TDocument> : IDocumentType where TDocument : Document
    {
        /// <summary>
        /// Determines whether this document type can create a new document.
        /// </summary>
        /// <returns>
        ///   <c>true</c> if this document type can; otherwise, <c>false</c>.
        /// </returns>
        bool CanNew();

        /// <summary>
        /// create a new document with a specified file path.
        /// </summary>
        /// <param name="filePath">The file path to create the document.</param>
        /// <returns>The document.</returns>
        TDocument New(string filePath);

        /// <summary>
        /// Determines whether this document type can open a document.
        /// </summary>
        /// <returns>
        ///   <c>true</c> if this document type can; otherwise, <c>false</c>.
        /// </returns>
        bool CanOpen();

        /// <summary>
        /// Opens a new document with a specified file path.
        /// </summary>
        /// <param name="filePath">The file path to open the document.</param>
        /// <returns>The document.</returns>
        TDocument Open(string filePath);

        /// <summary>
        /// Determines whether this document type can save the specified docuemnt type.
        /// </summary>
        /// <param name="docuemnt">The docuemnt.</param>
        /// <returns>
        ///   <c>true</c> if this instance can save the specified docuemnt; otherwise, <c>false</c>.
        /// </returns>
        bool CanSave(IDocument docuemnt);

        /// <summary>
        /// Saves the specified document.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="filePath">The file path to save the document.</param>
        void Save(TDocument document, string filePath);
    }
}
